<nz-content >
   <!-- <div class="search-collapse">
        <form
                nz-form
                [nzLayout]="'inline'">
            <nz-form-item>
                <nz-form-label>部门名称</nz-form-label>
                <nz-form-control>
                    <input nz-input [(ngModel)]="_cnd.deptName" name="deptName"/>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label>部门状态</nz-form-label>
                <nz-form-control>
                    <nz-select
                            style="width: 200px;"
                            [(ngModel)]="_cnd.status"
                            name="status"
                    >
                        <nz-option nzLabel="全部" nzValue=""></nz-option>
                    </nz-select>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-control>
                    <button nz-button class="btn-primary" (click)="search()"> <i nz-icon nzType="search"></i>搜索</button>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-control>
                    <button nz-button class="btn-warning" (click)="search(true)"> <i nz-icon nzType="sync"></i>重置</button>
                </nz-form-control>
            </nz-form-item>
        </form>
    </div>-->


    <div class="search-table" >

        <div class="operate">
            <button nz-button [nzType]="'primary'" (click)="openOrCloseModal(true)"><i nz-icon nzType="plus"></i>新增</button>
            <button nz-button [nzType]="'edit'"  [disabled]="!isEditBtn" (click)="editInfoTop()"><i nz-icon nzType="form"></i>编辑</button>
          <nz-radio-group>
            <button nz-button [nzType]="'refresh'" (click)="search()"><i nz-icon nzType="sync"></i>刷新</button>
          </nz-radio-group>
        </div>

        <nz-table
                #ajaxTable
                nzShowSizeChanger
                [nzFrontPagination]="false"
                [nzData]="_ngTree"
                [nzLoading]="loading"
                [nzSize]="small"
        >
            <thead>
            <tr>
                <th>
                </th>
                <th>部门名称</th>
                <th>部门状态</th>
                <th>显示顺序</th>
                <th>负责人</th>
                <th>手机</th>
                <th>邮箱</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            <ng-container *ngFor="let data of ajaxTable.data">
              <ng-container *ngFor="let item of  mapOfExpandedData[data.key]">
                <tr *ngIf="(item.parent && item.parent.expanded) || !item.parent">
                  <td>
                    <input name='deptKey'  type="radio" (click)="radioChange(item.key)">
                  </td>
                  <td  [nzIndentSize]="item.level * 20"
                       [nzShowExpand]="!!item.children"
                       [(nzExpand)]="item.expanded"
                       (nzExpandChange)="collapse(mapOfExpandedData[data.key], item, $event)"
                  >{{item.item.deptName}}</td>
                  <td>{{item.item.status}}</td>
                  <td>{{item.item.orderNum}}</td>
                  <td>{{item.item.leader}}</td>
                  <td>{{item.item.phone}}</td>
                  <td>{{item.item.email}}</td>
                  <td>
                    <button nz-button [nzType]="'add'"  (click)="addByParent(item)"><i nz-icon nzType="plus"></i>新增</button>
                    <button nz-button [nzType]="'edit'" (click)="editInfo(item.key)" ><i nz-icon nzType="form"></i>编辑</button>
                    <button nz-popconfirm
                            nzPopconfirmTitle="确定删除?"
                            nzPopconfirmPlacement="top"
                            (nzOnConfirm)="deleteOne(item)"
                            nz-button
                            [nzType]="'delete'" ><i nz-icon nzType="close"></i>删除</button>
                  </td>
                </tr>
              </ng-container>
            </ng-container>

            </tbody>

        </nz-table>

      <!--crud-->
      <nz-modal class="formNzModal"
                [(nzVisible)]="isVisible"
                [nzTitle]="modalTitle"
                [nzWidth]="modalWidth"
                nzMaskClosable="false"
                (nzOnCancel)="openOrCloseModal(false)"
                (nzOnOk)="saveOrUpdate()"
                [nzOkLoading]="isOkLoading"
      >
        <div style="padding:0px;overflow: auto;" [ngStyle]="{ 'height': autoHeight+'px'}">
        <form nz-form [formGroup]="validateForm" >
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24"  nzFor="parentId">上级部门</nz-form-label>
            <nz-form-control [nzSm]="14" [nzXs]="24">
              <nz-tree-select
                formControlName="parentId"
                id="parentId"
                [(nzDisabled)]="ngTreeDisabled"
                [nzNodes]="_ngTree"
                [nzDefaultExpandAll]="true"
                nzShowSearch
                nzPlaceHolder=""
              >
              </nz-tree-select>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24"  nzFor="deptName">部门名称</nz-form-label>
            <nz-form-control [nzSm]="14" [nzXs]="24">
              <input nz-input formControlName="deptName" id="deptName" />
            </nz-form-control>
          </nz-form-item>

          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24"  nzFor="orderNum">显示顺序</nz-form-label>
            <nz-form-control [nzSm]="14" [nzXs]="24">
              <input nz-input formControlName="orderNum" id="orderNum" />
            </nz-form-control>
          </nz-form-item>


          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24"  nzFor="leader">负责人</nz-form-label>
            <nz-form-control [nzSm]="14" [nzXs]="24">
              <input nz-input formControlName="leader" id="leader" />
            </nz-form-control>
          </nz-form-item>


          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24"  nzFor="phone">联系电话</nz-form-label>
            <nz-form-control [nzSm]="14" [nzXs]="24">
              <input nz-input formControlName="phone" id="phone" />
            </nz-form-control>
          </nz-form-item>


          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24"  nzFor="email">邮箱</nz-form-label>
            <nz-form-control [nzSm]="14" [nzXs]="24">
              <input nz-input formControlName="email" id="email" />
            </nz-form-control>
          </nz-form-item>


          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24"  nzFor="status">部门状态</nz-form-label>
            <nz-form-control [nzSm]="14" [nzXs]="24">
              <nz-select formControlName="status" id="status">
                <nz-option nzValue="0" nzLabel="正常"></nz-option>
                <nz-option nzValue="1" nzLabel="禁用"></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>

        </form>
        </div>
      </nz-modal>
    </div>



</nz-content>
